package com.bluemoon.model.test.dbImort.file;

import cn.com.bluemoon.daps.common.enums.DatabaseType;
import com.bluemoon.model.test.dbImort.file.DbResourceFile;
import com.bluemoon.model.test.dbImort.file.HiveExcelResourceFile;
import com.bluemoon.model.test.dbImort.file.MysqlExcelResourceFile;
import com.bluemoon.model.test.dbImort.file.PgsqlExcelResourceFile;

/**
 * @author Jarod.Kong
 * @date 2021/2/4 16:54
 */
public enum DbResourceFileFactory {
    ;

    public static DbResourceFile file(DatabaseType dbType, String filePath) {
        DbResourceFile dbResourceFile;
        if (dbType.equals(DatabaseType.HIVE)) {
            dbResourceFile = new HiveExcelResourceFile(filePath);
        } else if (DatabaseType.PGSQL.equals(dbType)) {
            dbResourceFile = new PgsqlExcelResourceFile(filePath);
        } else {
            dbResourceFile = new MysqlExcelResourceFile(filePath);
        }
        return dbResourceFile;
    }
}
